<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
	</head>
	<body>
		<div>过滤前的内容<br>
			<textarea id="pre"rows="10"cols="40"></textarea>
			<input type="button" name="" id="btn" value="过滤" />
		</div>
		<div>过滤后的内容<br>
			<textarea id="res"rows="10"cols="40"></textarea>
		</div>
		<script>
			var btn=document.getElementById('btn');
			btn.onclick=function(){
				var str=document.getElementById('pre').value;
				var reg=/[\u4e00-\u9fa5]|bad/gi;
				var newStr=str.replace(reg,'*');
               document.getElementById('res').innerHTML=newStr;
             
			}
			
		
		</script>
	</body>
</html>
